<template>
    <div class="FirstResume">
        <el-steps :active="stepsActive" align-center class="stepProgress">
            <el-step title="个人信息" icon="el-icon-user"></el-step>
            <el-step title="教育经历" icon="el-icon-reading"></el-step>
            <el-step title="工作经验" icon="el-icon-suitcase" v-show="jobTimeFlag"></el-step>
            <el-step title="求职意向" icon="el-icon-suitcase-1"></el-step>
            <el-step title="家庭成员" icon="el-icon-house"></el-step>
        </el-steps>
        <!-- 个人信息 -->
        <div class="form" v-if="stepsActive==0">
            <div class="title">个人信息 <span>必填</span></div>
            <el-form :model="form0" :rules="form0Rules" ref="form0">
                <div class="left fl">
                    <el-form-item label="姓名" prop="name">
                        <el-input v-model.trim="form0.name" placeholder="请填写真实姓名"></el-input>
                    </el-form-item>
                    <el-form-item label="性别" prop="sex">
                        <el-col>
                            <el-radio v-model="form0.sex" label="1" border>男</el-radio>
                            <el-radio v-model="form0.sex" label="2" border>女</el-radio>
                        </el-col>
                    </el-form-item>
                    <el-form-item label="户口所在地" prop="homeTownCode">
                        <el-cascader v-model="form0.homeTownCode" :options="areaList" placeholder="请选择户口所在地" style="width: 100%;"></el-cascader>
                    </el-form-item>
                    <el-form-item label="求职身份" prop="identity">
                        <el-col>
                            <el-radio v-model="form0.identity" label="1" border
                                      @change="identityChange">职场人</el-radio>
                            <el-radio v-model="form0.identity" label="2" border @change="identityChange">应届生</el-radio>
<!--               2022年3月12日13:50:16 左右客户要求去除             <el-radio v-model="form0.identity" label="3" border @change="identityChange">在校生</el-radio>-->
                        </el-col>
                    </el-form-item>
                    <el-form-item label="婚姻状况" prop="maritalStatus">
                        <el-col>
                            <el-radio v-model="form0.maritalStatus" label="0" border style="margin-bottom: 10px;">未婚</el-radio>
                            <el-radio v-model="form0.maritalStatus" label="1" border style="margin-bottom: 10px;">已婚已育</el-radio>
                            <el-radio v-model="form0.maritalStatus" label="2" border>已婚未育</el-radio>
                            <el-radio v-model="form0.maritalStatus" label="3" border>离异</el-radio>
                        </el-col>
                    </el-form-item>
                </div>
                <div class="right fr">
                    <el-form-item label="电子邮箱" prop="email">
                        <el-input v-model.trim="form0.email" placeholder="请填写电子邮箱"></el-input>
                    </el-form-item>
                    <el-form-item label="出生年月" prop="birthday">
                        <el-date-picker v-model="form0.birthday" type="date" value-format="timestamp" :picker-options="pickerOptions" placeholder="请选择出生年月" style="width: 100%;"></el-date-picker>
                    </el-form-item>
                    <el-form-item label="现居住城市" prop="liveCityCode">
                        <el-cascader v-model="form0.liveCityCode" :options="areaList" placeholder="请选择现居住城市" style="width: 100%;"></el-cascader>
                    </el-form-item>
                    <el-form-item label="参加工作时间" prop="jobTime" v-if="jobTimeFlag">
                        <el-date-picker v-model="form0.jobTime" type="month" value-format="timestamp" :picker-options="pickerOptions" placeholder="请选择参加工作时间" style="width: 100%;"></el-date-picker>
                    </el-form-item>
                    <el-form-item label="求职状态" prop="workState">

                        <el-select  v-if="form0.identity!= '2'" v-model="form0.workState" placeholder="请选择求职状态" style="width: 100%">
                            <el-option label="离职-随时到岗" value="0"></el-option>
                            <el-option label="在职-月内到岗" value="1"></el-option>
                            <el-option label="在职-考虑机会" value="2"></el-option>
                            <el-option label="在职-暂不考虑" value="3"></el-option>
                        </el-select>

                        <el-select v-if="form0.identity=='2'" v-model="form0.workState" placeholder="请选择求职状态" style="width: 100%">
                            <el-option label="在校学生-实习中" value="4"></el-option>
                            <el-option label="在校学生-求职中" value="5"></el-option>
                            <el-option label="在校学生" value="6"></el-option>
                        </el-select>

                    </el-form-item>
                </div>
                <div class="cl">
                    <!-- <el-form-item label="家庭成员及重要社会关系">
                        <el-table height="250" border size="mini" empty-text="未添加家庭成员信息" style="width: 100%">
                        <el-table-column label="称谓" align="center" prop="date"> </el-table-column>
                        <el-table-column label="姓名" align="center" prop="date"> </el-table-column>
                        <el-table-column label="年龄" align="center" prop="date"> </el-table-column>
                        <el-table-column label="政治面貌" align="center" prop="date"> </el-table-column>
                        <el-table-column label="单位" align="center" prop="date"> </el-table-column>
                        <el-table-column label="称谓" align="center" prop="date"> </el-table-column>
                    </el-table>
                    </el-form-item>
                      -->
                </div>
                <div class="btns">
                    <el-button type="primary" @click="submitForm('form0')">下一步</el-button>
                </div>
            </el-form>
        </div>
        <!-- 教育经历 -->
        <div class="form" v-if="stepsActive==1">
            <div class="title">教育经历<span>必填</span></div> <!--（需从高中填起）  -->
            <div class="tip">请填写国家承认的教育经历，非培训经历</div>
            <el-form :model="form1" :rules="form1Rules" ref="form1">
                <div class="left fl">

                    <el-form-item label="学历" prop="eduLevel">
                        <el-select v-model="form1.eduLevel" placeholder="请选择学历" style="width: 100%">
                            <el-option label="博士" value="7"></el-option>
                            <el-option label="MBA/EMBA" value="6"></el-option>
                            <el-option label="研究生" value="5"></el-option>
                            <el-option label="本科" value="4"></el-option>
                            <el-option label="大专" value="3"></el-option>
                            <el-option label="中专/中技" value="2"></el-option>
                            <el-option label="高中" value="1"></el-option>
                            <el-option label="初中" value="0"></el-option>
                        </el-select>
                    </el-form-item>


<!--                    <el-form-item label="是否统招" prop="recruitmentFlag">-->
<!--                        <el-col>-->
<!--                            <el-radio v-model="form1.recruitmentFlag" label="0" border>统招</el-radio>-->
<!--                            <el-radio v-model="form1.recruitmentFlag" label="1" border>非统招</el-radio>-->
<!--                            <el-radio v-model="form1.recruitmentFlag" label="2" border>国外学历</el-radio>-->
<!--                        </el-col>-->
<!--                    </el-form-item>-->
                    <el-form-item label="就读时间" prop="studyTime">
                        <el-date-picker v-model="form1.studyTime" type="monthrange" :unlink-panels="true" value-format="timestamp" range-separator="至" start-placeholder="入学时间" end-placeholder="毕业时间" style="width: 100%"></el-date-picker>
                    </el-form-item>

                    <el-form-item label="是否全日制" prop="r2">
                        <el-col>
                            <el-switch v-model="form1.r2" active-text="是" inactive-text="不是" active-value="1" inactive-value="2"></el-switch>
                        </el-col>
                    </el-form-item>
                </div>
                <div class="right fr">
                    <el-form-item label="学校名称" prop="schoolName">
                        <el-autocomplete v-model.trim="form1.schoolName" @input="getSearch(form1.schoolName,'university')" :fetch-suggestions="querySearch" :trigger-on-focus="false" placeholder="请填写学校名称" style="width: 100%" @select="handleSelect">
                            <template slot-scope="{ item }">
                                <div class="name">{{ item.title }}</div>
                            </template>
                        </el-autocomplete>
                    </el-form-item>
                    <el-form-item label="所学专业（如有第二学位可一并填写，如：物流管理/工商管理）" prop="major">
                        <el-autocomplete v-model.trim="form1.major" @input="getSearch(form1.major,'speciality')" :fetch-suggestions="querySearch"
                                         :trigger-on-focus="false" placeholder="请填写所学专业（如没有可填：无）" style="width: 100%" @select="handleSelect1">
                            <template slot-scope="{ item }">
                                <div class="name">{{ item.title }}</div>
                            </template>
                        </el-autocomplete>
                    </el-form-item>

                    <el-form-item label="学位" prop="r1">
                        <el-select v-model="form1.r1" placeholder="请选择学位" style="width: 100%">

                            <el-option label="学士" value="1"></el-option>
                            <el-option label="硕士" value="2"></el-option>
                            <el-option label="博士" value="3"></el-option>
                            <el-option label="无" value="0"></el-option> <!-- 2022年3月30日15:26:56  添加-->
                        </el-select>
                    </el-form-item>
                </div>
                <div class="cl"></div>
                <div class="btns">
                    <el-button @click="returnBack('form1')">返回上一步</el-button>
                    <el-button type="primary" @click="submitForm('form1')">下一步</el-button>
                </div>
            </el-form>
        </div>
        <!-- 工作经验 -->
        <div class="form" v-if="stepsActive==2&&jobTimeFlag">
            <div class="title">工作经验 <span>必填</span></div>
            <el-form :model="form2" :rules="form2Rules" ref="form2">
                <div class="left fl">
                    <el-form-item label="公司名称" prop="companyName">
                        <el-input v-model.trim="form2.companyName" placeholder="请填写公司名称" style="width: 100%"></el-input>
                    </el-form-item>
                    <el-form-item label="所任职位" prop="positionName">
                        <el-cascader ref="jobPosition" v-model="form2.positionName" :options="jobPosition" filterable @change="chooseJobPosition" :show-all-levels="false" placeholder="请选择所任职位" style="width: 100%"></el-cascader>
                    </el-form-item>
                </div>
                <div class="right fr">
                    <el-form-item label="在职时间" prop="workTime">
                        <el-date-picker v-model="form2.workTime" type="monthrange" value-format="timestamp" :unlink-panels="true" :picker-options="pickerOptions" range-separator="至" start-placeholder="入职时间" end-placeholder="离职时间" style="width: 100%"></el-date-picker>
                    </el-form-item>
                    <el-form-item label="税前月薪/元" prop="salary">
                        <el-input type="number" v-model.trim="form2.salary" placeholder="请填写税前月薪/元" style="width: 100%"></el-input>
                    </el-form-item>
                    <!-- <el-form-item label="该份工作需要的技能">
                        <el-select v-model="form2.skill" multiple placeholder="该份工作需要的技能" style="width: 100%">
                            <el-option v-for="(item,index) in skills" :key="index" :label="item.label" :value="item.value"></el-option>
                        </el-select>
                    </el-form-item> -->
                </div>
                <div class="cl"></div>
                <el-form-item label="工作内容" prop="workContent">
                    <el-input type="textarea" placeholder="请填写工作内容" v-model="form2.workContent" maxlength="1600" show-word-limit/>
                </el-form-item>
                <div class="btns">
                    <el-button @click="returnBack('form2')">返回上一步</el-button>
                    <el-button type="primary" @click="submitForm('form2')">下一步</el-button>
                </div>
            </el-form>
        </div>
        <!-- 求职意向 -->
        <div class="form" v-if="stepsActive==3">
            <div class="title">求职意向 <span>必填</span></div>
            <el-form :model="form3" :rules="form3Rules" ref="form3">
                <div class="left fl">
                    <el-form-item label="求职类型" prop="workType">
                        <el-col>
                            <el-radio v-model="form3.workType" label="0" border>全职</el-radio>
                            <el-radio v-model="form3.workType" label="1" border>兼职</el-radio>
                            <el-radio v-model="form3.workType" label="2" border>实习</el-radio>
                        </el-col>
                    </el-form-item>
                    <el-form-item label="薪资要求范围" prop="money">
                        <el-select v-model="form3.money" placeholder="请选择薪资要求范围" style="width: 100%">
                            <el-option v-for="item in moneyOptions" :key="item.value" :label="item.label" :value="item.value"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="期望地点" prop="city">
                        <el-cascader v-model="form3.city" :options="areaList" placeholder="请选择期望地点"  style="width: 100%;"></el-cascader>
                    </el-form-item>
                </div>
                <div class="right fr">
                    <el-form-item label="期望职位" prop="workNature">
                        <el-cascader v-model="form3.workNature" :options="jobPosition" :show-all-levels="false" placeholder="请选择期望职位" style="width: 100%"></el-cascader>
                    </el-form-item>
                    <el-form-item label="期望行业" prop="workIndustry">
                        <el-cascader v-model="form3.workIndustry" :options="industryList" :show-all-levels="false" placeholder="请选择期望行业" style="width: 100%"></el-cascader>
                    </el-form-item>
                </div>
                <div class="cl"></div>
                <div class="btns">
                    <el-button @click="returnBack('form3')">返回上一步</el-button>
                    <el-button type="primary" @click="submitForm('form3')">下一步</el-button>
                </div>
            </el-form>
        </div>


        <!-- 家庭成员 -->
        <div class="form" v-if="stepsActive==4">
            <div class="title">家庭成员及重要社会关系 <span>必填</span></div>
            <el-form :model="form4" :rules="form4Rules" ref="form4">
                <div class="left fl">
                    <el-form-item label="称谓" prop="appellation">
<!--                        <el-input v-model.trim="form4.appellation" placeholder="请填写称谓"></el-input>-->
                        <el-select v-model="form4.appellation" placeholder="请选择称谓" style="width: 100%">
                            <el-option label="父亲" value="父亲"></el-option>
                            <el-option label="母亲" value="母亲"></el-option>
                            <el-option label="丈夫" value="丈夫"></el-option>
                            <el-option label="妻子" value="妻子"></el-option>
                            <el-option label="儿子" value="儿子"></el-option>
                            <el-option label="女儿" value="女儿"></el-option>

                        </el-select>
                    </el-form-item>

                    <el-form-item label="年龄" prop="age">
                        <el-input type="number" v-model.trim="form4.age" placeholder="请填写年龄"></el-input>
                    </el-form-item>

                    <el-form-item label="单位" prop="company">
                        <el-input  v-model.trim="form4.company" placeholder="请填写单位"></el-input>
                    </el-form-item>

                    <el-form-item label="备注" >
                        <el-input  v-model.trim="form4.remark" placeholder="请填写备注"></el-input>
                    </el-form-item>
                </div>
                <div class="right fr">
                    <el-form-item label="姓名" prop="name">
                        <el-input v-model.trim="form4.name" placeholder="请填写姓名"></el-input>
                    </el-form-item>

                    <el-form-item label="政治面貌" prop="politics">
                        <el-select v-model="form4.politics" placeholder="请选择政治面貌" style="width:100%">
                            <el-option label="中共党员" value="中共党员"></el-option>
                            <el-option label="中共预备党员" value="中共预备党员"></el-option>
                            <el-option label="无党派人士" value="无党派人士"></el-option>
                            <el-option label="共青团员" value="共青团员"></el-option>
                            <el-option label="群众" value="群众"></el-option>
                            <el-option label="其他" value="其他"></el-option>
                        </el-select>
                    </el-form-item>

                    <el-form-item label="职位" prop="position">
                        <el-input  v-model.trim="form4.position" placeholder="请填写职位"></el-input>
                    </el-form-item>
                </div>

                <div class="cl"></div>
                <div class="btns">
                    <el-button @click="returnBack('form4')">返回上一步</el-button>
                    <el-button type="primary" @click="submitForm('form4')">完成</el-button>
                </div>
            </el-form>
        </div>
    </div>
</template>

<script>
import {
    baseData,
    baseSearch,
    cvFamilyMemberAdd,
    cvFamilyMemberEdit,
    eduInfoEdit,
    getResume,
    personInfo,
    personInfoEdit,
    workInfoEdit,
    workIntentionEdit
} from '@/api/api'

export default {
    //组件注入
    components: {},
    //存放数据
    data() {
        return {
            userName: '',
            userId: '',
            stepsActive: 0,
            firstResumeIds: {},//四块id
            form0: {
                    name:'',//姓名
                    sex:'',//性别
                    homeTownCode:[],//户口所在地
                    identity:'',//求职身份
                    email:'',//邮箱
                    birthday:'',//出生年月
                    liveCityCode:[],//居住城市
                    jobTime:'',//工作时间
                    workState:'',//求职状态
                    maritalStatus:'',//婚姻
                },
                form0Rules:{
                    name: [
                        { required: true, message: '请填写真实姓名',},
                    ],
                    sex: [
                        { required: true, message: '请选择您的性别',},
                    ],
                    homeTownCode:[
                        { required: true, message: '请填写户口所在地',},
                    ],
                    identity: [
                        { required: true, message: '请选择求职身份',},
                    ],
                    email: [
                        { required: true, message: '请填写电子邮箱',},
                        { type: 'email', message: '请输入正确的电子邮箱', trigger: ['blur', 'change'] }
                    ],
                    birthday: [
                        { required: true, message: '请选择出生年月',}
                    ],
                    liveCityCode: [
                        { required: true, message: '请选择现居住城市',},
                    ],
                    jobTime: [
                        { required: true, message: '请选择参加工作时间',}
                    ],
                    workState: [
                        { required: true, message: '请选择求职状态',}
                    ],
                    maritalStatus: [
                        { required: true, message: '请选择婚姻状况',}
                    ],
                },
                form1:{
                    schoolName:'',//学校
                    recruitmentFlag:'',//是否统招
                    studyTime:'',//就读时间
                    eduLevel:'',//最高学历
                    major:'',//所学专业
                    r1: '', // 学位 1 学士 2 硕士 3 博士
                    r2: '1',  // 是否全日制 1 是 2 不是
                },
                form1Rules:{
                    schoolName: [
                        { required: true, message: '请填写学校名称',},
                    ],
                    recruitmentFlag: [
                        { required: true, message: '请选择是否统招',},
                    ],
                    studyTime: [
                        { required: true, message: '请选择就读时间',},
                    ],
                    eduLevel: [
                        { required: true, message: '请选择学历',},
                    ],
                    major: [
                        { required: true, message: '请填写所学专业',},
                    ],
                    r1: [
                        { required: true, message: '请选择学位',},
                    ],
                    r2: [
                        { required: true, message: '是否是全日制',},
                    ],
                },
                form2:{
                    companyName:'',//公司
                    positionName:'',//职位
                    workTime:'',//在职时间
                    skill:'',//所需技能
                    workContent:'',//工作内容
                    salary:'',//税前月薪
                },
                form2Rules:{
                    companyName: [
                        { required: true, message: '请填写公司名称',},
                    ],
                    positionName: [
                        { required: true, message: '请选择所任职位',},
                    ],
                    workTime: [
                        { required: true, message: '请选择在职时间',},
                    ],
                    skill: [
                        { required: true, message: '该份工作需要的技能',},
                    ],
                    workContent: [
                        { required: true, message: '请输入工作内容',},
                    ],
                    salary: [
                        { required: true, message: '请选择税前月薪',},
                        { validator: this.$numberText, trigger: 'blur' },
                    ],
                },
                form3:{
                    workType:'',//求职类型
                    money:'',//期望薪资
                    workIndustry:'',//期望行业
                    workNature:'',//期望职位
                    city:'',//期望地点
                },
                moneyOptions:[
                    {
                        value:'0-1000',
                        label:'1000元/月以下'
                    },
                    {
                        value:'1000-2000',
                        label:'1000-2000元/月'
                    },
                    {
                        value:'2000-4000',
                        label:'2000-4000元/月'
                    },
                    {
                        value:'4000-6000',
                        label:'4000-6000元/月'
                    },
                    {
                        value:'6000-8000',
                        label:'6000-8000元/月'
                    },
                    {
                        value:'8000-10000',
                        label:'8000-10000元/月'
                    },
                    {
                        value:'10000-15000',
                        label:'10000-15000元/月'
                    },
                    {
                        value:'15000-25000',
                        label:'15000-25000元/月'
                    },
                    {
                        value:'25000-35000',
                        label:'25000-35000元/月'
                    },
                    {
                        value:'35000-50000',
                        label:'35000-50000元/月'
                    },
                    {
                        value:'50000-70000',
                        label:'50000-70000元/月'
                    },
                    {
                        value:'70000-100000',
                        label:'70000-100000元/月'
                    },
                    {
                        value:'100000-999999',
                        label:'100000元/月以上'
                    }
                ],
                form3Rules: {
                    workType: [
                        { required: true, message: '请选择求职类型',},
                    ],
                    money: [
                        { required: true, message: '请选择薪资要求范围',},
                    ],
                    city: [
                        { required: true, message: '请选择期望地点',},
                    ],
                    workNature: [
                        { required: true, message: '请选择期望职位',},
                    ],
                    workIndustry: [
                        { required: true, message: '请选择期望行业',},
                    ],
                },
                form4: {
                    appellation: '', // 称谓
                    name: '', // 姓名
                    age: null, // 年龄
                    company: '', // 单位
                    position: '', // 职位
                    politics: '', // 政治面貌
                    remark: '', // 备注
                },
                form4Rules: {

                    appellation: [
                        {required: true, message: '请填写称谓',},
                    ],

                    name: [
                        {required: true, message: '请填写亲属姓名',},
                    ],
                    birthday: [
                        {required: true, message: '请填写出生年月',},
                    ],
                    age: [
                        {required: true, message: '请填写年龄',},
                    ],
                    politics: [
                        {required: true, message: '请填写政治面貌',},
                    ],
                    education: [
                        {required: true, message: '请填写文化程度',},
                    ],
                    position: [
                        {required: true, message: '请填写职位',},
                    ],
                    company: [
                        {required: true, message: '请填写单位',},
                    ],
                    phone: [
                        {required: true, message: '请填写联系电话',},
                    ],
                },
                pickerOptions:{
                    disabledDate(time) {
                        return time.getTime() > Date.now();
                    },
                },
                jobPosition:[],//职位
                areaList:[],//省市区
                searchList:[],//联想搜索列表
                industryList:[],//行业列表
                skills:[],//技能列表
                jobTimeFlag:true
            }
        },
        //接受父组件传递的值
        props:[],
        //监控data中的数据变化
        watch: {},
        //方法集合
        methods: {
            //根据关键词搜索学校/职位
            getSearch(val,type){
                baseSearch({
                    'title.keywords': val,
                    'type': type,
                }).then(res =>{
                    if(res.code==200){
                        this.searchList = res.result
                    }
                });
            },
            //选择职位查询技能
            chooseJobPosition(e){
                let nodesObj = this.$refs['jobPosition'].getCheckedNodes()
                let val = nodesObj[0].value
                //查询技能
                baseData({
                    'code': val,
                    'clz':'skills'
                }).then(res =>{
                    if(res.code==200){
                        this.skills = res.result
                    }
                });
            },
            //联想
            querySearch(queryString, cb) {
                var searchList = this.searchList;
                var results = queryString ? searchList.filter(this.createFilter(queryString)) : searchList;
                // 调用 callback 返回建议列表的数据
                cb(results);
            },
            createFilter(queryString) {
                return (searchList) => {
                    return (searchList.title.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
                };
            },
            //选择联想学校
            handleSelect(item){
                this.form1.schoolName = item.title
            },
            //选择联想专业
            handleSelect1(item){
                this.form1.major = item.title
            },
            //求职身份切换
            identityChange(e){
                // console.log(e)
                console.log('求职身份切换', e, this.form0.identity);
                this.form0.workState = ""
                if(e!=1){
                    this.jobTimeFlag = false
                }else{
                    this.jobTimeFlag = true
                }
            },
            //提交表单
            submitForm(formName) {
                this.$refs[formName].validate((valid) => {
                    if(valid) {
                        if(formName=='form0'){
                            //编辑个人信息接口
                            personInfoEdit({
                                'id':this.id,
                                'userId':this.userId,
                                'username':this.userName,
                                'name':this.form0.name,//姓名
                                'sex':this.form0.sex,//性别
                                'homeTownCode':this.form0.homeTownCode,//户口所在地
                                'identity':this.form0.identity,//求职身份
                                'email':this.form0.email,//邮箱
                                'birthday':this.form0.birthday,//出生年月
                                'liveCityCode':this.form0.liveCityCode,//所在城市
                                'jobTime':this.form0.jobTime,//工作时间
                                'jobFlag':this.jobTimeFlag?1:0,//工作时间
                                'workState': this.form0.workState,//工作状态
                                'maritalStatus': this.form0.maritalStatus,//工作状态
                                'photoId':'',//头像id
                            }).then(res =>{
                                console.log(res);
                                if(res.code==200){
                                    this.$message.success('保存成功');
                                    this.stepsActive++
                                }else{
                                    this.$message.error(res.message);
                                }
                            });
                        }
                        if(formName=='form1'){
                            //编辑教育经历接口
                            eduInfoEdit({
                                'id':this.firstResumeIds.eduId,
                                'userId':this.userId,
                                'resumeId':this.firstResumeIds.resumId,
                                'schoolName':this.form1.schoolName,//学校
                                'eduLevel':this.form1.eduLevel,//最高学历
                                'recruitmentFlag':this.form1.recruitmentFlag,//是否统招
                                'major':this.form1.major,//专业
                                'startEduTime':this.form1.studyTime[0],//就读时间
                                'endEduTime':this.form1.studyTime[1],//毕业时间
                                'r1': this.form1.r1,
                                'r2': this.form1.r2,
                            }).then(res =>{
                                console.log(res);
                                if(res.code==200){
                                    this.$message.success('保存成功');
                                    if(this.jobTimeFlag){
                                        this.stepsActive++
                                    }else{
                                        this.stepsActive = this.stepsActive+2
                                    }
                                }else{
                                    this.$message.error(res.message);
                                }
                            });
                        }
                        if(formName=='form2'){
                            //编辑工作接口
                            workInfoEdit({
                                'id':this.firstResumeIds.workId,
                                'userId':this.userId,
                                'resumeId':this.firstResumeIds.resumId,
                                'companyName':this.form2.companyName,//公司名称
                                'positionNameCode':this.form2.positionName,//职位
                                'workStartTime':this.form2.workTime[0],//入职时间
                                'workEndTime':this.form2.workTime[1],//离职时间
                                'workContent':this.form2.workContent,//工作内容
                                'salary': this.form2.salary,//税前月薪
                            }).then(res =>{
                                console.log(res);
                                if(res.code==200){
                                    this.$message.success('保存成功');
                                    this.stepsActive++
                                }else{
                                    this.$message.error(res.message);
                                }
                            });
                        }
                        if(formName=='form3'){
                            //编辑求职意向接口
                            workIntentionEdit({
                                'id':this.firstResumeIds.intentionId,
                                'userId':this.userId,
                                'resumeId':this.firstResumeIds.resumId,
                                'workType':parseInt(this.form3.workType),//求职类型
                                'workNatureCode':this.form3.workNature,//期望职位
                                'minMoney':parseInt(this.form3.money.split('-')[0]),//薪资下限
                                'maxMoney':parseInt(this.form3.money.split('-')[1]),//薪资上限
                                'workIndustryCode':this.form3.workIndustry,//期望行业
                                'cityStringCode':this.form3.city,//期望地点
                            }).then(res =>{
                                console.log(res);
                                if(res.code==200){
                                    this.$message.success('保存成功');
                                    this.stepsActive++
                                    // setTimeout(()=>{
                                    //     this.$router.push({name:'Index'})
                                    // },1000)
                                }else{
                                    this.$message.error(res.message);
                                }
                            });
                        }

                        if(formName=='form4'){
                            let form = JSON.parse(JSON.stringify(this.form4))
                            form.resumeId = this.firstResumeIds.resumId
                            if(!form.id){
                                //新增
                                cvFamilyMemberAdd(form).then(res =>{
                                    if(res.code==200){
                                        this.$message.success('保存成功');
                                        setTimeout(()=>{
                                            this.$router.push({name:'Index'})
                                        },1000)
                                    }else{
                                        this.$message.error(res.message);
                                    }
                                });
                            }else{
                                //编辑
                                cvFamilyMemberEdit(form).then(res =>{
                                    if(res.code==200){
                                        this.$message.success('保存成功');
                                        setTimeout(()=>{
                                            this.$router.push({name:'Index'})
                                        },1000)
                                    }else{
                                        this.$message.error(res.message);
                                    }
                                });
                            }
                        }

                        //获取用户信息
                        personInfo({
                            'id': this.userId
                        }).then(res =>{
                            console.log(res);
                            if(res.code==200){
                                localStorage.setItem('userInfo',JSON.stringify(res.result))
                            }
                        });
                    }else{
                        console.log('error submit!!');
                        return false;
                    }
                });
            },
            //返回上一步
            returnBack(formName){
                if(this.stepsActive>0){
                    if(!this.jobTimeFlag){
                        if(this.stepsActive==3){
                            this.stepsActive = this.stepsActive - 2
                        }else{
                            this.stepsActive = this.stepsActive - 1
                        }
                    }else{
                        this.stepsActive = this.stepsActive - 1
                    }
                    this.$refs[formName].clearValidate();
                }
            }
        },
        //生命周期 - 创建完成（可以访问当前this实例）
        created() {},
        //生命周期 - 挂载完成（可以访问DOM元素）
        mounted() {
            this.userName = JSON.parse(localStorage.getItem('userInfo')).username
            this.userId = JSON.parse(localStorage.getItem('userInfo')).userId
            this.id = JSON.parse(localStorage.getItem('userInfo')).id
            this.firstResumeIds = JSON.parse(localStorage.getItem('firstResume'))
            //哪个没填去哪个选项卡
            if(parseInt(this.$route.query.stepsActive)){
                this.stepsActive = parseInt(this.$route.query.stepsActive)
            }
            console.log('stepsActive='+this.stepsActive)
            //省市区查询
            baseData({
                'clz':'area'
            }).then(res =>{
                if(res.code==200){
                    this.areaList = res.result
                }
            });
            //职位查询
            baseData({
                'clz':'position'
            }).then(res =>{
                if(res.code==200){
                    this.jobPosition = res.result
                }
            });
            //行业查询
            baseData({
                'clz':'industry'
            }).then(res =>{
                if(res.code==200){
                    this.industryList = res.result
                }
            });
            //调简历信息
            getResume({
                'resumeId': this.firstResumeIds.resumId,
            }).then(res =>{
                if(res.code==200){
                    //个人信息
                    if(res.result.userInfo.name){
                        this.form0.name = res.result.userInfo.name
                        this.form0.email = res.result.userInfo.email
                        this.form0.sex = res.result.userInfo.sex.toString()
                        this.form0.birthday = res.result.userInfo.birthday
                        this.form0.homeTownCode = res.result.userInfo.homeTownCode
                        this.form0.liveCityCode = res.result.userInfo.liveCityCode
                        this.form0.workState = res.result.userInfo.workState.toString()
                        this.form0.jobTime = res.result.userInfo.jobTime
                        this.form0.identity = res.result.userInfo.idEntity.toString()
                        this.form0.maritalStatus = res.result.userInfo.maritalStatus.toString()
                        if(res.result.userInfo.jobFlag==1){
                            this.jobTimeFlag = true
                        }else if(res.result.userInfo.jobFlag==0){
                            this.jobTimeFlag = false
                        }
                    }
                    //教育经历
                    if(res.result.userEduInfos.length>0&&res.result.userEduInfos[0].schoolName){
                        this.form1.schoolName = res.result.userEduInfos[0].schoolName
                        this.form1.eduLevel = res.result.userEduInfos[0].eduLevel.toString()
                        this.form1.recruitmentFlag = res.result.userEduInfos[0].recruitmentFlag.toString()
                        this.form1.major = res.result.userEduInfos[0].major
                        this.form1.studyTime = [res.result.userEduInfos[0].startEduTime,res.result.userEduInfos[0].endEduTime]
                    }
                    //工作经验
                    if(res.result.userWorkInfos.length>0&&res.result.userWorkInfos[0].companyName){
                        this.form2.companyName = res.result.userWorkInfos[0].companyName
                        this.form2.positionName = res.result.userWorkInfos[0].positionNameCode
                        this.form2.workTime = [res.result.userWorkInfos[0].workStartTime,res.result.userWorkInfos[0].workEndTime]
                        this.form2.workContent = res.result.userWorkInfos[0].workContent
                        this.form2.skill = res.result.userWorkInfos[0].workSignCode
                        this.form2.salary = res.result.userWorkInfos[0].salary
                    }
                    //求职意向经验
                    if(res.result.workIntentions.length>0&&res.result.workIntentions[0].workType){
                        this.form3.workType = res.result.workIntentions[0].workType
                        this.form3.workNature = res.result.workIntentions[0].workNatureCode
                        var money = res.result.workIntentions[0].minMoney+'-'+res.result.workIntentions[0].maxMoney
                        this.form3.money = money
                        this.form3.workIndustry = res.result.workIntentions[0].workIndustryCode
                        this.form3.city = res.result.workIntentions[0].cityStringCode
                    }

                    // 家庭成员及重要社会关系
                    if(res.result.familyMembers.length>0){
                        this.form4 = res.result.familyMembers[0]
                    }
                }
            });
        }
    };
</script>
<style lang="scss">
    @mixin text-ellipsis{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
    @mixin text-ellipsisclamp($clamp){display: -webkit-box;-webkit-box-orient: vertical;-webkit-line-clamp: $clamp;overflow: hidden;}
    @mixin transition{transition: all .3s;}
    .FirstResume{min-height: 100vh;height: auto;overflow: hidden;background: #F6F6F6;
        .stepProgress{width: 600px;height: auto;overflow: hidden;padding-top: 100px;margin: 0 auto;
            .el-step__icon{background: #f6f6f6;}
        }
        .form{width: 1000px;height: auto;overflow: hidden;margin: 40px auto;background: #fff;padding: 50px;
            .title{font-size: 20px;color: #000;font-weight: bold;
                span{width: 44px;height: 24px;line-height: 24px;font-size: 14px;color: #fff;font-weight: normal;border-radius: 10px 0px 10px 0px;background: #E54437;display: inline-block;text-align: center;vertical-align: 2px;margin-left: 5px}
            }
            .tip{font-size: 14px;color: #999;margin-top: 10px;}
            .el-form{height: auto;overflow: hidden;margin-top: 40px;
                .left,.right{width: 48%;
                    .el-radio{min-width: 88px;text-align: center;margin: 0 10px 0 0;border-radius: 0;
                        &:last-child{margin: 0;}
                    }
                    .el-input__inner{border-radius: 0;}
                    .el-icon-date,.el-input__icon{vertical-align: -2px;}
                }
                .el-textarea__inner{height: 200px;border-radius: 0;padding: 15px}
                .el-textarea .el-input__count{line-height: normal;}
                .btns{margin: 50px auto;text-align: center;
                    button{width: 220px;margin: 0 15px}
                }
            }
        }
    }
</style>
